/**
 * 文字信息
 * @param options
 * @constructor
 */
function TextMessage(options){
    this.options = {
        "version":"1.0",
        "msgType":"text",
        "msg":{}
    };
    this.options = Object.assign(this.options, options);//将设定参数和默认参数进行合并操作;
    TextMessage.prototype.addExtra = function(key,value){
        this.options.msg[key]=value;
    }
    TextMessage.prototype.toJson = function(){
        return JSON.stringify(this.options)
    }
}

/**
 * 图片消息
 * @param options
 * @constructor
 */
function ImgMessage(options){
    this.options = {
        "version":"1.0",
        "msgType":"img",
        "msg":{}
    };
    this.options = Object.assign(this.options, options);//将设定参数和默认参数进行合并操作;
    ImgMessage.prototype.addExtra = function(key,value){
        this.options.msg[key]=value;
    }
    ImgMessage.prototype.toJson = function(){
        return JSON.stringify(this.options)
    }
}


/**
 * 声音消息
 * @param options
 * @constructor
 */
function AudioMessage(options){
    this.options = {
        "version":"1.0",
        "msgType":"audio",
        "msg":{}
    };
    this.options = Object.assign(this.options, options);//将设定参数和默认参数进行合并操作;
    AudioMessage.prototype.addExtra = function(key,value){
        this.options.msg[key]=value;
    }
    AudioMessage.prototype.toJson = function(){
        return JSON.stringify(this.options)
    }
}


/**
 * 文件消息
 * @param options
 * @constructor
 */
function DocumentMessage(options){
    this.options = {
        "version":"1.0",
        "msgType":"document",
        "msg":{}
    };
    this.options = Object.assign(this.options, options);//将设定参数和默认参数进行合并操作;
    DocumentMessage.prototype.addExtra = function(key,value){
        this.options.msg[key]=value;
    }
    DocumentMessage.prototype.toJson = function(){
        return JSON.stringify(this.options)
    }
}
